// 懒加载
import { Suspense, lazy } from 'react';
import { Navigate, useRoutes } from 'react-router-dom'
import { Spin } from '@arco-design/web-react';
// 懒加载
import Home from "../views/Home/Home";
const Login = lazy(() => import("../views/Login/Login"));
const Car = lazy(() => import("../views/Car/Car"));
const Addk =lazy(() => import("../views/Car/Addk"));
//系统管理
//账号管理
const System = lazy(() => import('../views/System/System'))
//系统日志
const Log = lazy(() => import('../views/System/Log'));
//权限
const Power = lazy(() => import('../views/System/Power'))
//添加跳转路由
const PowerJump = lazy(() => import('../views/System/power/addJump'))

//查询管理
const DataQuery = lazy(() => import('../views/DataQuery/DataQuery'))

//账号管理子路由

const Account = lazy(() => import('../views/System/Account/Account'))
const Newmessage = lazy(() => import('../views/System/Account/newMessage'))
const Security = lazy(() => import('../views/System/Account/security'))
const Accountbind = lazy(() => import('../views/System/Account/accountBind'))
// const Login =lazy(()=>import("../views/Login/Login")) ;


//报表管理
const Report = lazy(() => import('../views/Report/Report'));

const Business = lazy(() => import('../views/Report/pages/business/business'));
const ParkingRecord = lazy(() => import('../views/Report/pages/business/parking_record/parking_record'));

const Etc = lazy(() => import('../views/Report/pages/etc/etc'));

const Statistical = lazy(() => import('../views/Report/pages/statistical/statistical'));
const DailyChargesTable = lazy(() => import('../views/Report/pages/statistical/daily_charges/daily_charges_table/daily_charges_table'))
const DailyChargesChart = lazy(() => import('../views/Report/pages/statistical/daily_charges/daily_charges_chart/daily_charges_chart'))

//运维管理
const Equipment = lazy(() => import("../views/Operations/Equipment/Equipment"));
const Operation = lazy(() => import("../views/Operations/EquipmentOperation/EquipmentOperation"));
const Maintenance = lazy(() => import("../views/Operations/OperationMaintenance/OperationMaintenance"));
const Stopvehicle = lazy(() => import("../views/Operations/StopVehicle/StopVehicle"));
const AddStopVehicle = lazy(() => import('../views/Operations/StopVehicle/AddStopVehicle.js'))

//------------------------------------

//Financec财务管理
const FinanceBox = lazy(() => import("../views/Finance"));
const Finance = lazy(() => import("../views/Finance/Finance"));
const Total = lazy(() => import("../views/Finance/total"));
const Deta = lazy(() => import("../views/Finance/deta"));
const Single = lazy(() => import("../views/Finance/total/single"));
const Handle = lazy(() => import("../views/Finance/deta/handle"));
const Result = lazy(() => import("../views/Finance/deta/result"));


//Car
const Index = lazy(() => import("../views/Index/Index"));
const Routers = () => {
  return useRoutes([
    {
      path: '/',
      element: <Navigate to="/login" />,
    },
    {
      path: '/login',
      element: <Login />
    },
    {
      path: '/home',
      element: <Home />,
      // 子路由
      children: [

        {
          path: 'index',
          element: <Suspense fallback={<Spin dot />}><Index /></Suspense>
        },
        {
          path: 'car',
          // 懒加载
          element: <Suspense fallback={<Spin dot />}><Car /></Suspense>,
        },
        {
          path: 'addk',
          // 懒加载
          element: <Suspense fallback={<Spin dot />}><Addk /></Suspense>,
        },
        //数据查询

        {
          path: 'dataquery',
          element: <Suspense fallback={<Spin dot />}><DataQuery /></Suspense>
        },
        //账号管理
        {
          path: 'system',
          // 懒加载
          element: <Suspense fallback={<Spin dot />}><System /></Suspense>,
          children: [
            //基本设置

            {
              path: 'account',
              // 懒加载
              element: <Suspense fallback={<Spin dot />}><Account /></Suspense>,

            },
            //安全设置
            {
              path: 'security',
              element: <Suspense fallback={<Spin dot />}><Security /></Suspense>,
            },
            //账号绑定
            {
              path: 'bind',
              element: <Suspense fallback={<Spin dot />}><Accountbind /></Suspense>,
            },
            //新信息通知
            {
              path: 'message',
              element: <Suspense fallback={<Spin dot />}><Newmessage /></Suspense>,
            }
          ]
        },
        //权限管理
        {
          path: 'power',
          // 懒加载
          element: <Suspense fallback={<Spin dot />}><Power /></Suspense>,
          children: [
            {
              path: 'PowerJump',
              element: <Suspense fallback={<Spin dot />}><PowerJump /></Suspense>
            }
          ]
        },
        //系统日志
        {
          path: 'log',
          // 懒加载
          element: <Suspense fallback={<Spin dot />}><Log /></Suspense>,
        },
        {
          path: 'equipment',
          element: <Suspense fallback={<Spin dot />}><Equipment /></Suspense>
        },
        {
          path: 'operation',
          element: <Suspense fallback={<Spin dot />}><Operation /></Suspense>
        },
        {
          path: 'maintenance',
          element: <Suspense fallback={<Spin dot />}><Maintenance /></Suspense>
        },
        {
          path: 'stopvehicle',
          element: <Suspense fallback={<Spin dot />}><Stopvehicle /></Suspense>
        },
        {
          path: 'addStopVehicle',
          element: <Suspense fallback={<Spin dot />}><AddStopVehicle /></Suspense>
        },
        // 报表管理
        {
          path: 'report',
          element: <Suspense fallback={<Spin dot />}><Report /></Suspense>,
          children: [
            //业务报表
            {
              index: 'index',
              element: <Suspense fallback={<Spin dot />}><Business /></Suspense>,
            },
            {
              path: 'parkingRecord',
              element: <Suspense fallback={<Spin dot />}><ParkingRecord /></Suspense>,
            },

            //ETC结算报表
            {
              path: 'etc',
              element: <Suspense fallback={<Spin dot />}><Etc /></Suspense>,
            },

            //统计报表
            {
              path: 'statistical',
              element: <Suspense fallback={<Spin dot />}><Statistical /></Suspense>,
            },
            {
              path: 'dailyChargesTable',
              element: <Suspense fallback={<Spin dot />}><DailyChargesTable /></Suspense>,
            },
            {
              path: 'dailyChargesChart',
              element: <Suspense fallback={<Spin dot />}><DailyChargesChart /></Suspense>,
            }
          ]
        },
        {
          path: 'finance',//账务管理1
          element: <Suspense fallback={<Spin dot />}><FinanceBox /></Suspense>,
          children: [
            {
              path: 'index',//账目管理1-0
              element: <Suspense fallback={<Spin dot />}><Finance /></Suspense>,
            },
            {
              path: 'total',//对账汇总1-1
              element: <Suspense fallback={<Spin dot />}><Total /></Suspense>,
            },
            {
              path: 'deta',//差错明细1-2
              element: <Suspense fallback={<Spin dot />}><Deta /></Suspense>,
            },
            {
              path: 'single',//汇总详情1-1-1
              element: <Suspense fallback={<Spin dot />}><Single /></Suspense>,
            },
            {
              path: 'handle',//人工处理1-2-1
              element: <Suspense fallback={<Spin dot />}><Handle /></Suspense>,
            },
            {
              path: 'result',//查看处理状态1-2-2
              element: <Suspense fallback={<Spin dot />}><Result /></Suspense>,
            }
          ]
        }




      ]

    }
  ])
}
export default Routers